package com.dafasoft.jnicallbacktest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    static {
        System.loadLibrary("native-lib");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        TextView tv = findViewById(R.id.sample_text);
        tv.setText(stringFromJNI());

        JniTester tester = new JniTester();
        Log.d("zyl", "startTime = " + System.currentTimeMillis());
        tester.setOnResultCallback(result -> {
            Log.d("zyl", "endTime = " + System.currentTimeMillis());
            Log.d("zyl", "result = " + result);
        });
        tester.requestData();
    }

    public native String stringFromJNI();
}